Oracle 查询存储过程做横向报表的方法
/* 创建日期 姓名 */
-- 删除:根据ID删除刚刚插入的记录
max(case when b.term_type='T21' then b.c else 0 end) as T21,
t4M ,
(
包的定义声明:
group by a.term_type, a.biz_idmax(case when b.term_type='T14' then b.c else 0 end) as T14,
o_cursor OUT bulletin_report_type)
BEGIN
tCount as tCount,
set_id_bulletin_report_temp as id_bulletin_report_temp,
t07 ,
复制代码 代码如下:
t21 ,report.biz_id,
/* 参数说明: */
max(case when b.term_type='T2M' then b.c else 0 end) as T2M,
delete from scms_bulletin_report_temp temp where temp.id_bulletin_report_temp = set_id_bulletin_report_temp;
t01 as t01 ,
max(case when b.term_type='T07' then b.c else 0 end) as T07,
select c.*,
scms_capital_dynamic_manage manager
scms_capital_assign_detail detail,
max(case when b.term_type='T2Y' then b.c else 0 end) as T2Y,
report.biz_id,
from
select
commit;
and detail.id_capital_dynamic_manage = i_id_capital_dynamic_manage
t6M as t6M ,
t6M ,
/* 创建日期 姓名 */
'总计(天数)' as biz_Name,
scms_common_packge.get_biz_name(b.biz_id) as biz_Name,
)
) a
t01 ,
t2M ,
PROCEDURE p_list_bulletin_report( i_id_capital_dynamic_manage
IN
VARCHAR2,
t2M
,
from(
insert into scms_bulletin_report_temp
PROCEDURE p_list_bulletin_report( i_id_capital_dynamic_manage
IN
VARCHAR2,
order by sortNo asc;
t14
,
因为要牵扯到小计,所以需要计算两次。
where manager.id_capital_dynamic_manage = detail.id_capital_dynamic_manage/************************************************************************************/
detail.term_type
(
)
max(case when b.term_type='T3M' then b.c else 0 end) as T3M,
max(case when b.term_type='T21' then b.c else 0 end) as T21,
/*
*/
t4M
as t4M ,
sort_no
as sortNo
想法:
and manager.IS_CONFIRM = '1'set_id_bulletin_report_temp as id_bulletin_report_temp,
select
t1M ,
3、查询临时表记录放置到游标中。
max(case when b.term_type='T4M' then b.c else 0 end) as T4M,CREATE OR REPLACE PACKAGE BODY CHEN_TEST_PACKGE IS max(case when b.term_type='T14' then b.c else 0 end) as T14,
/************************************************************************************/
1、把查询到的结果,插入到临时表,
select a.term_type,'biz_id_count' as biz_id, sum(a.capital_claim) c/* i_id_capital_dynamic_manage IN VARCHAR2 某种公告ID */
2、把统计结果插入到临时表。
t21 as t21 ,) c;
sort_no
/* o_cursor OUT bulletin_report_type 返回游标 */
/* */
/* 2013-03-08 路人甲 */
/* 参数说明: */
END p_list_bulletin_report;
t1M as t1M ,
复制代码 代码如下:
--select to_char(sysdate,'yyyymmddhh24missSSS') into set_id_bulletin_report_temp from dual;and report.id_capital_assign_detail = detail.id_capital_assign_detail
tCount ,
END CHEN_TEST_PACKGE;
max(case when b.term_type='T4M' then b.c else 0 end) as T4M,
from scms_capital_claim_report report,
where manager.id_capital_dynamic_manage = detail.id_capital_dynamic_manage
max(case when b.term_type='T1Y' then b.c else 0 end) as T1Y,
max(case when b.term_type='T5M' then b.c else 0 end) as T5M,
set_id_bulletin_report_temp VARCHAR2(50); -- 定义临时变量
t2M as t2M ,
id_bulletin_report_temp,
/
insert into scms_bulletin_report_temp
/* 2013-03-08 路人甲 */
max(case when b.term_type='T6M' then b.c else 0 end) as T6M,
CREATE OR REPLACE PACKAGE CHEN_TEST_PACKGE IS
max(case when b.term_type='T1M' then b.c else 0 end) as T1M,
from (select report.capital_claim,
open o_cursor for
biz_Name
as bizName ,
--给临时变量赋值
(select max(sort_no)+1 from scms_bulletin_report_temp te where te.id_bulletin_report_temp = set_id_bulletin_report_temp ) as sort_no
select c.*,
4、删除临时表记录。
detail.term_type
where temp.id_bulletin_report_temp = set_id_bulletin_report_temp
group by a.term_type
max(case when b.term_type='T2M' then b.c else 0 end) as T2M,
max(case when b.term_type='T01' then b.c else 0 end) as T01,
/* 功能说明:查询某种公告报表
*/
t1Y
,
t2Y
,
t3M
as t3M ,
max(case when b.term_type='T07' then b.c else 0 end) as T07,
max(case when b.term_type='T1Y' then b.c else 0 end) as T1Y,
/*
i_id_capital_dynamic_manage IN VARCHAR2
某种公告ID
*/
max(case when b.term_type='T1M' then b.c else 0 end) as T1M,
/************************************************************************************/
) c;
sort_no
/* 功能说明:查询某种公告报表
*/
(
t5M
,
(
from(
o_cursor
OUT
cursor_type);
from scms_bulletin_report_temp temp
t1M ,
from
id_bulletin_report_temp,
AS
t01 ,
scms_capital_assign_detail detail,
-- 插入总记录数
END CHEN_TEST_PACKGE;
tCount
,
from (select report.capital_claim,
biz_Name
,
max(case when b.term_type='T3M' then b.c else 0 end) as T3M,
/************************************************************************************/
scms_capital_dynamic_manage manager
-- 查询刚刚插入的表记录
t07 as t07 ,
--获取数据插入临时表
) b group by b.biz_id
) a
and manager.IS_CONFIRM = '1'
type cursor_type is ref cursor; t3M ,
max(case when b.term_type='T6M' then b.c else 0 end) as T6M,
t2Y ,
and manager.IS_SETTLEMENT = '1'
sum(b.c) as BIZ_ID_COUNT
t1Y as t1Y ,
/* o_cursor OUT cursor_type 返回游标 */
from scms_capital_claim_report report,
begin
t1Y ,
and detail.id_capital_dynamic_manage = i_id_capital_dynamic_manage
t14 ,
页面调用ibatis的xml配置查询结果: t2Y as t2Y ,
select
max(case when b.term_type='T01' then b.c else 0 end) as T01,
t21 ,
and manager.IS_SETTLEMENT = '1'
) b group by b.biz_id
id_bulletin_report_temp as idBulletinReportTemp,
t5M ,
select i_id_capital_dynamic_manage into set_id_bulletin_report_temp from dual;
t3M ,
复制代码 代码如下:
end;t4M ,
t07 ,
biz_Name ,
t6M ,
包的实现:
rownum as sort_nomax(case when b.term_type='T5M' then b.c else 0 end) as T5M,
select a.term_type,a.biz_id, sum(a.capital_claim) c
max(case when b.term_type='T2Y' then b.c else 0 end) as T2Y,
and report.id_capital_assign_detail = detail.id_capital_assign_detail
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/sql/oracle/3809.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
是因为scan的IP问题补占用
时间:2021-01-20
-
还你一个干净的model 2、功
时间:2021-01-20
-
既然 ROWNUM 列并不是真实存
时间:2021-01-20
-
Real Application Clusters
时间:2021-01-20
-
在tools-preferences-connection(
时间:2021-01-20
-
Windows Sever 2012下Oracle 12c安
时间:2021-01-10
-
Oracle安装监听器错误的解
时间:2021-01-07
-
oracle远程连接服务器数据
时间:2021-01-07
热门文章
-
Oracle存储过程编程详解
时间:2020-12-07
-
Azure Queue Storage 基本用法 Azure Storage 之
时间:2020-12-26
-
win10下oracle 11g安装图文教程
时间:2020-12-25
-
oracle 数据库学习 基本结构介绍
时间:2020-12-13
-
Azure File Storage 基本用法 Azure Storage 之 F
时间:2020-12-26
-
windows使用sqlpus连接oracle 数据库的教程图
时间:2020-12-25
-
Window下Oracle Database 11g 发行版2安装教程
时间:2020-12-29
-
Oracle解锁的方式介绍
时间:2020-12-14
-
Oracle 12c Study之Installer Oracle
时间:2021-01-06
-
linux下oracle设置开机自启动实现方法
时间:2020-12-13
